<?php
include_once "db.php";
include_once "checksession.php"; 
include_once "auth_permissions.php"; 
authorize("user");

$problem = mysql_query("select * from problem_type WHERE problem_type.status = '0'");

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Add a Phone Call Ticket</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="meta-style.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
</head>

<body>

<?php
include_once "topnav.php";
// auto fill out area of the form that were enterend in if phonecall came back an error
if (isset($_GET['f_name']) && $_GET['f_name'] != 'error') $first_name = $_GET['f_name'] ? $_GET['f_name'] : null;
if (isset($_GET['email']) && $_GET['email'] != 'error') $email = $_GET['email'] ? $_GET['email'] : null;
if (isset($_GET['l_name']) && $_GET['l_name'] != 'error') $last_name = $_GET['l_name'] ? $_GET['l_name'] : null;
if (isset($_GET['Problem']) && $_GET['Problem'] != 'error') $problem_notes = $_GET['Problem'] ? $_GET['Problem'] : null;
if (isset($_GET['notes']) && $_GET['notes'] != 'error') $notes = $_GET['notes'] ? $_GET['notes'] : null;
if (isset($_GET['KNum']) && $_GET['KNum'] != 'error') $KNum = $_GET['KNum'] ? $_GET['KNum'] : null;
if (isset($_GET['pipelineuserid']) && $_GET['pipelineuserid'] != 'error') $pipelineuserid = $_GET['pipelineuserid'] ? $_GET['pipelineuserid'] : null;
if (isset($_GET['dayphone']) && $_GET['dayphone'] != 'error') $dayphone = $_GET['dayphone'] ? $_GET['dayphone'] : null;
if (isset($_GET['problem_type']) && $_GET['problem_type'] != 'error') $problem_type = $_GET['problem_type'] ? $_GET['problem_type'] : null;
?>

<FORM action="insert_phone.php" METHOD="POST">
	<input type="hidden" name="HDuserID" value="<? echo $_SESSION['ID'] ?>">
	<!--<input type="hidden" name="contact_type" value="phone"> -->
	<?
 if ($_GET['error']) {
  if($_GET['f_name'] == "error") {
   print "<p class='error'>Please enter your First Name.</p>";
  }
  if($_GET['l_name'] == "error") {
   print "<p class='error'>Please enter your Last Name.</p>";
  } 
    if($_GET['email'] == "error") {
   print "<p class='error'>Please enter your Email.</p>";
  }
      if($_GET['problem_type'] == "error") {
   print "<p class='error'>Please select your Problem Type. If you don't know, select Other.</p>";
  }
  if($_GET['call_closed'] == "error") {
   print "<p class='error'>Please choose Yes or No to open/close this call.</p>";
  }
  if($_GET['Problem'] == "error") {
   print "<p class='error'>Please enter information about the student's problem.</p>";
  }
  
 }
?>
   <table width="800" BORDER=1 cellpadding=5 cellspacing=0 bordercolor="#006699" background="#CCCCCC" align="center">
    <tr align="left" valign="top">
      <td colspan="2" bordercolor="#006699" bgcolor="#006699"><font color="white"><span class="style1">Add a New Phone Call Ticket</span></td>
    </tr>
	<tr>
	<td colspan="2"><font color="red">* = Required</font></td>
	</tr>
    <tr valign="top">
      <td width="50%" align="right" class="normalblue"><b><font color="#FF0000"></font>First Name</b></td>
      <td width="50%" align="left"><input name="f_name" type="TEXT" id="f_name" value="<?php echo $first_name; ?>" size="35"></td>
    </tr>
    <tr valign="top">
      <td width="50%" align="right" class="normalblue"><b><font color="#FF0000"></font>Last Name</b></td>
      <td width="50%" align="left"><input name="l_name" type="TEXT" id="l_name" value="<?php echo $last_name; ?>" size="35"></td>
    </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><b>Daytime Phone</b></td>
       <td align="left"><input name="dayphone" type="TEXT" id="dayphone" value="<?php echo $dayphone; ?>" size="35"></td>
     </tr>
     <tr valign="top">
       <td width="50%" align="right" class="normalblue"><b><font color="#FF0000"></font>Return Email Address</b></td>
       <td width="50%" align="left"><input name="email" type="TEXT" id="email" value="<?php echo $email; ?>" size="35"></td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><b>Student ID (K#)</b></td>
       <td align="left"><input name="KNum" type="TEXT" id="KNum" value="<?php echo $KNum; ?>" size="35"></td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><b>Pipeline ID</b></td>
       <td align="left"><input name="pipelineuserid" type="TEXT" id="pipelineuserid" value="<?php echo $pipelineuserid; ?>" size="35"></td>
     </tr>
	   <tr valign="top">
       <td width="50%" align="right" class="normalblue"><b><font color="#FF0000">*</font>Problem or Question Category</b></td>
       <td width="50%" align="left"><select selected="<?php echo $problem_type; ?>" name="problem_type" size=1 id="problem_type" value="">
         <option value="">Select your problem type...</option>
		 <?php
		 while($problemresults = mysql_fetch_array($problem)) {
		 echo "<option value=\"".$problemresults[PT_ID]."\">".$problemresults[PT_desc]. "</option>\n";
	      }
	     ?>
       </select></td>
     </tr>
    <tr valign="top">
      <td width="50%" align="right" class="normalblue"><b><font color="#FF0000"></font>Enter student's problem details here.</b></td>
      <td width="50%" align="left"><span class="normalblue">
        <textarea name="Problem" rows=5 cols=40 wrap="soft"><?php echo $problem_notes; ?></textarea>
      </span></td>
    </tr>
          <tr valign="top">
       <td align="right" class="normalblue"><strong><b><font color="#FF0000">*</font></b>Higher Level Call ?</strong> </td>
       <td align="left" class="normalblue"><input name="high_level" type="radio" value="1">
         Yes
         <input name="high_level" type="radio" value="2" >
         No</td>
     </tr>
     <tr valign="top">
       <td align="right" class="normalblue"><strong><b><font color="#FF0000">*</font></b>Call Closed?</strong> </td>
       <td align="left" class="normalblue"><input name="call_closed" type="radio" value="2">
         Yes
         <input name="call_closed" type="radio" value="1" >
         No</td>
     </tr>
	  <tr valign="top">
       <td align="right" class="normalblue"><strong>Pending student reply?</strong> </td>
       <td align="left" class="normalblue"><input name="pending" type="radio" value="1">
         Yes
         <input name="pending" type="radio" value="2" checked="checked" >
         No</td>
		</tr>
      <tr valign="top">
		<td align="right" class="normalblue"><strong><b><font color="#FF0000">*</font></b>Contact Type?</strong> </td>
		<td align="left" class="normalblue">
	  
 
   			<input type="radio" name="contact_type" value="phone" >Phone
			<input type="radio" name="contact_type" value="email">Email
			<input type="radio" name="contact_type" value="in-person">In-Person
			<input type="radio" name="contact_type" value="voicemail">Voicemail
         </td>
     </tr>
	  <tr valign="top">
		<td align="right" class="normalblue"><strong>Transferred?</strong> </td>
		<td align="left" class="normalblue"><select name="transfer_to">
          <option value=""></option>
          <option value="admissions">Admissions</option>
          <option value="admissions sup">Admissions Supervisor</option>
          <option value="counseling">Counseling</option>
          <option value="cashiers">Cashiers</option>
          <option value="financial aid">Financial Aid</option>
          <option value="faculty Staff HD">Faculty Staff HD</option>
          <option value="other">Other Ext. (please specify)</option>
        </select></td>
     <tr valign="top">
       <td align="right" class="normalblue"><strong>If the call is closed, how did you help student? </strong></td>
       <td align="left"><span class="normalblue">
          <textarea name="notes" cols=40 rows=5 wrap="soft" id="notes"><?php echo $notes; ?></textarea>
       </span></td>
     </tr>
     <tr valign="top">
       <td width="50%" align="right" class="normalblue">&nbsp;</td>
       <td width="50%" align="left"><span class="normalblue">
         <input type=SUBMIT value="Submit Call" name="SUBMIT">
       </span></td>
     </tr>
  </table>
</FORM>

   
</body>
</html>
